/*******************************************************************************
* Copyright (c) 2020 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
*     IBM Corporation - initial API and implementation
*******************************************************************************/

import { createStore, applyMiddleware} from 'redux';
import thunk from 'redux-thunk';

import {setLocale}  from '../localeActions';
import reducers from '../../reducers/index';

// initialize redux stores
const store = createStore(reducers, {
  localeReducer: { lang: 'en' },
}, applyMiddleware(thunk));

describe('localeActions', () => {
  it('Gets the default locale', () => {
    expect (store.getState().localeReducer.lang).toBe('en');
  });
  it('Changes locala to es', () => {
    store.dispatch( setLocale('es') );
    expect (store.getState().localeReducer.lang).toBe('es');
  });
});
